<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>练习三</title>
</head>
<body>
    <script>
        function print(n) {
          console.log("乘法表");
          let str = "";
          for (let i = 1; i <= n; i++) {
            for (let j = 1; j <= i; j++) {
                str += j +"*"+ i + "=" + j*i + " ";
            }
            str += "\n";
          }
          console.log(str);
        }
        let n = Math.floor(Math.random()*9+1);
        console.log(n);
        print(n)
    </script>
</body>
</html>